import React from "react";
import { PictureOutlined, ManOutlined, WomanOutlined } from "@ant-design/icons";
import { Image, Tooltip, Tag } from "antd";
import { SQUARE_STATUS } from "@/utils/constant";

// 文字悬浮提示
export const getToolTip = (text) => (
  <Tooltip placement="topLeft" title={text}>
    {text}
  </Tooltip>
);

// 展示缩略图
export const getImage = (avatar) =>
  avatar ? (
    <Image width={40} height={40} placeholder src={avatar} />
  ) : (
    <PictureOutlined style={{ fontSize: 35 }} />
  );

// 获取性别
export const getSex = (sex) =>
sex ? <><span>女</span><WomanOutlined /></> : <><span>男</span><ManOutlined /></>;

// 获取审核状态
export const getStatus = (status) => {
  //  0-未审核 1-审核通过 2-审核不通过
  let color = "",
    text = "";
  switch (status) {
    case 1:
      text = SQUARE_STATUS[1];
      color = "#25b752";
      break;
    case 2:
      text = SQUARE_STATUS[2];
      color = "#b74725"; //红色
      break;
    default:
      text = SQUARE_STATUS[0];
      color = "#c3bfbe"; //灰色
      break;
  }
  return (
    <Tag color={color} key={status}>
      {text}
    </Tag>
  );
};
